Skip to content

Conversation

siddsriv
Copy link
Contributor

@siddsriv siddsriv commented May 16, 2024

Description

introduces a new eslint rule to enforce consistent type imports using the import type syntax.

running eslint with the --fix flag will enforce this rule and modify your file according to the consistent type imports eslint rule.

Testing

as an example:

import { S3Client, PutObjectCommand, PutObjectCommandInput } from "@aws-sdk/client-s3";

upon running eslint on this file, it would throw:

1:1  error  Import "PutObjectCommandInput" is only used as types  

this should be written as so (can be done by running eslint with the --fix flag):

import type { PutObjectCommandInput } from "@aws-sdk/client-s3";
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";

For this repo,

% npx eslint lib      
.
.
.
✖ 8 problems (0 errors, 8 warnings)

and,

% npx eslint packages
.
.
.
✖ 188 problems (0 errors, 188 warnings)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@siddsriv siddsriv requested a review from a team as a code owner May 16, 2024 15:44
@siddsriv siddsriv requested a review from a team as a code owner May 16, 2024 17:20
@siddsriv siddsriv marked this pull request as draft September 11, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant